﻿using System.Linq.Expressions;
using Dyao.Book.Contract;
using Dyao.Book.Entity;

namespace Dyao.Book.Repository.Abstractions
{
    public interface IBookCatalogueMatchSourceRepository : IDataRepository<BookCatalogueMatchSourceEntity>
    {
        /// <summary>
        /// 批量添加
        /// </summary>
        /// <param name="entities">添加实体</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns></returns>
        Task BulkInsertAsync(IEnumerable<BookCatalogueMatchSourceEntity> entities, CancellationToken cancellationToken = default);

        /// <summary>
        /// 批量更新
        /// </summary>
        /// <param name="entities">添加实体</param>
        /// <param name="updateSelector">选择器</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns></returns>
        Task BulkUpdateAsync(IEnumerable<BookCatalogueMatchSourceEntity> entities, Expression<Func<BookCatalogueMatchSourceEntity, object>> updateSelector, CancellationToken cancellationToken = default);

        /// <summary>
        /// 根据过滤对象获取集合
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="filter">过滤对象</param>
        /// <param name="selector">选择对象</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns></returns>
        Task<List<T>> GetListByFilterAsync<T>(ChapterSourceFilterDto filter, Expression<Func<BookCatalogueMatchSourceEntity, T>> selector, CancellationToken cancellationToken = default);
    }
}
